package com.example.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class BCryptPasswordEncoderUtils {
    private static BCryptPasswordEncoder bCryptPasswordEncoder=new BCryptPasswordEncoder();

    public static String encodePassword(String password){
        return bCryptPasswordEncoder.encode(password);
    }

    public static Boolean matchPassword(String password, String password2) {
        return bCryptPasswordEncoder.matches(password, password2);
    }

    public static void main(String[] args) {
        //admin  $2a$10$dkej1Y4AggRsoAEoNbDqCeUIleK6ghxSGDeDmtbbYf9jH2qUxeqFW
        //docker  $2a$10$FwyU0QLzLUM8ZkY.wLW0..kgU2InbNsuafKzRSyq5fHwceQI6.CKa
        //user  $2a$10$vaJJvC/8PtAK6XRVOT5vWuN/1EM1xSaKSRItZ9M4ibuCFuf9hEPc.
        String password="123456";
        String pwd = encodePassword(password);

        Boolean aBoolean = matchPassword("123456", encodePassword("123456"));
        System.out.println(aBoolean);

        System.out.print(pwd);
    }
}
